{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": "from build_docker import *\nimport unittest\nimport pprint\n\nDEBUG_MODE \u003d False\n\nthis_script_path \u003d os.path.realpath(\u0027__file__\u0027)"
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": [
        "# example args for testing different scenarios\n",
        "EXAMPLE_BUILD_TAG \u003d \"my.example\"\n",
        "\n",
        "# build from local files, and push to both Dockerhub and GCR\n",
        "EXAMPLE_ARGS_LOCAL \u003d [\u0027--targets\u0027, \u0027all\u0027, \n",
        "                      \u0027--image-tag\u0027, EXAMPLE_BUILD_TAG, \n",
        "                      \u0027--dockerhub-root\u0027, \u0027shuangbroad\u0027,\n",
        "                      \u0027--gcr-project\u0027, \u0027broad-dsde-methods\u0027]\n",
        "\n",
        "# build from remote (Github) files, but not pushing\n",
        "EXAMPLE_ARGS_REMOTE \u003d [\u0027--targets\u0027, \u0027all\u0027, \n",
        "                       \u0027--image-tag\u0027, EXAMPLE_BUILD_TAG, \n",
        "                       \u0027--remote-git-hash\u0027, \u002772acbdce2660e7cc360aebcd71f47c4665a7002a\u0027, \n",
        "                       \u0027--staging-dir\u0027, \u0027/Users/shuang/Desktop/tmp\u0027,\n",
        "                       \u0027--use-ssh\u0027]\n",
        "\n",
        "# build a single image, but\n",
        "# it has dependencies that must be built first\n",
        "EXAMPLE_ARGS_DEPENDENCY \u003d [\u0027--targets\u0027, \u0027sv-pipeline-rdtest\u0027, \n",
        "                           \u0027--image-tag\u0027, EXAMPLE_BUILD_TAG]\n",
        "\n",
        "# tells git to ignore untracked files and uncommitted changes\n",
        "# (applies only when building from local files)\n",
        "EXAMPLE_ARGS_TURNOFF_GIT_PROTECT \u003d [\u0027--targets\u0027, \u0027sv-pipeline-rdtest\u0027, \n",
        "                                    \u0027--image-tag\u0027, EXAMPLE_BUILD_TAG, \n",
        "                                    \u0027--disable-git-protect\u0027]"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": [
        "# you can use the example args above, or provide your own args\n",
        "actual_args \u003d [\u0027--targets\u0027, \u0027all\u0027, \n",
        "               \u0027--image-tag\u0027, EXAMPLE_BUILD_TAG]\n",
        "\n",
        "parse_and_build(CMD_line_args_parser(actual_args).project_args,\n",
        "                this_script_path)"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.7.3"
    },
    "varInspector": {
      "cols": {
        "lenName": 16,
        "lenType": 16,
        "lenVar": 40
      },
      "kernels_config": {
        "python": {
          "delete_cmd_postfix": "",
          "delete_cmd_prefix": "del ",
          "library": "var_list.py",
          "varRefreshCmd": "print(var_dic_list())"
        },
        "r": {
          "delete_cmd_postfix": ") ",
          "delete_cmd_prefix": "rm(",
          "library": "var_list.r",
          "varRefreshCmd": "cat(var_dic_list()) "
        }
      },
      "types_to_exclude": [
        "module",
        "function",
        "builtin_function_or_method",
        "instance",
        "_Feature"
      ],
      "window_display": false
    }
  },
  "nbformat": 4,
  "nbformat_minor": 2
}